FROM linuxkit/systemd-boot:1e21eeea040fa7c55553e54d7d9f14d8ff75a24a AS systemd-boot

FROM linuxkit/alpine:7f3944798557de5518a56e3437d7ed982701f224 AS mirror
RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/
RUN apk add --no-cache --initdb -p /out \
  alpine-baselayout \
  binutils \
  busybox \
  dosfstools \
  libarchive-tools \
  mtools \
  sfdisk \
  sgdisk \
  xfsprogs \
  py3-pefile \
  && true
RUN mv /out/etc/apk/repositories.upstream /out/etc/apk/repositories

FROM scratch
WORKDIR /
COPY --from=mirror /out/ /
COPY --from=systemd-boot . .
COPY . .
ENTRYPOINT [ "/make-efi" ]
